package com.yanyu.space.member.feign;

import com.yanyu.space.common.core.bean.web.R;
import com.yanyu.space.common.core.constants.SpaceConstants;
import com.yanyu.space.member.bean.bo.StudentBo;
import com.yanyu.space.member.feign.fallback.MemberClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "space-member",
        contextId = "space-member-1",
        fallbackFactory = MemberClientFallbackFactory.class
)
public interface IMemberClient {

    @GetMapping(SpaceConstants.Feign.FEIGN_PREFIX_PATH + "/hello")
    R<String> testRequestParam(@RequestParam("param") String param);

    @PostMapping(SpaceConstants.Feign.FEIGN_PREFIX_PATH + "/hello1")
    R<String> testRequestBody(@RequestBody StudentBo bo);

    @GetMapping(SpaceConstants.Feign.FEIGN_PREFIX_PATH + "/throw/fallback/hello2")
    R<String> testThrowFallbackFactory1(@RequestParam("param") String param);

    @PostMapping(SpaceConstants.Feign.FEIGN_PREFIX_PATH + "/throw/fallback/hello1")
    R<String> testThrowFallbackFactory2(@RequestParam("param") String param);
}
